﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Class1
    {
        private string str = "Class1.str";
        private int i = 0;
        static void StringConvert(string str)
        {
            str = "string being converted.";
        }
        static void StringConvert(Class1 c)
        {
            c.str = "string being converted.";
        }
        static void Add(int i)
        {
            i++;
        }
        static void AddWithRef(ref int i)
        {
            i++;
        }
        static void Main(string[] args)
        {
            #region 测试Demo1
            int i1 = 10;
            int i2 = 20;
            string str = "str";
            Class1 c = new Class1();
            Add(i1);
            AddWithRef(ref i2);
            Add(c.i);
            StringConvert(str);
            StringConvert(c);
            Console.WriteLine(i1);
            Console.WriteLine(i2);
            Console.WriteLine(c.i);
            Console.WriteLine(str);
            Console.WriteLine(c.str);
            Console.WriteLine();
            #endregion



            #region 测试Demo2
            A a = new B();
            a.Fun();
            Console.WriteLine();
            B b = new B();
            b.Fun();
            Console.WriteLine();
            #endregion



            #region  测试Demo3
            C c2 = new C();
            D d = new D();
            c2.Fun2(d);
            d.Fun2(c2);
            
            Console.WriteLine();
            #endregion

            Console.ReadKey();
        }


    }


}
